﻿using MvvmCross.Core.ViewModels;
using Sidvall.UI.ViewModels;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Sidvall.UI.Uwp.Test.ViewModels
{
    public class Page1ViewModel : ViewModelBase
    {
        #region BooleanTypes

        private Sidvall.Data.KeyValueCollection<string, BooleanType> _BooleanTypes;
        public Sidvall.Data.KeyValueCollection<string, BooleanType> BooleanTypes
        {
            get
            {
                if (_BooleanTypes == null)
                {
                    var items = new Sidvall.Data.KeyValueCollection<string, BooleanType>();
                    items.Add("Yes", BooleanType.Yes);
                    items.Add("No", BooleanType.No);
                    items.Add("Not relevant", BooleanType.None);
                    this.BooleanTypes = items;
                }
                return _BooleanTypes;
            }
            private set
            {
                _BooleanTypes = value;
                RaisePropertyChanged(nameof(BooleanTypes));
            }
        }

        #endregion
        #region TestValue1

        private BooleanType _TestValue1 = BooleanType.Yes;
        public BooleanType TestValue1
        {
            get
            {
                return _TestValue1;
            }
            set
            {
                _TestValue1 = value;
                RaisePropertyChanged(nameof(TestValue1));
            }
        }

        #endregion

        public ICommand GoPageCommand
        {
            get
            {
                return new MvxCommand(() => GoPage());
            }
        }
        public void GoPage()
        {
            ShowViewModel<Page2ViewModel>((object)null, false, "CenterContent");
        }
        protected override Task StartAsync()
        {
            Sidvall.UI.SystemContext.Current.ApplicationManager.Status = Sidvall.UI.ApplicationStatus.Started;
            return Task.FromResult(true);
        }
    }
}
